package api

import (
	"GIN-API/global"
	"GIN-API/internal/handlers"
	"GIN-API/internal/repository"
	"GIN-API/internal/service"
	"github.com/gin-gonic/gin"
)

func InitArticleRouter(r *gin.RouterGroup) {
	articleHandler := handlers.NewArticleHandler(service.NewArticleService(repository.NewArticleRepo(global.DB), repository.NewCoverRepo(global.DB)))
	r.POST("/articles", articleHandler.CreateArticle)
	r.GET("/articles/:id", articleHandler.GetArticleByID)
	r.PUT("/articles/:id", articleHandler.UpdateArticle)
	r.DELETE("/articles/:id", articleHandler.DeleteArticle)
	r.GET("/articles/list", articleHandler.GetAllArticles)
}
